﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using com.zhongjh.Library.Configuration;

namespace com.zhongjh.Library.Database
{
    public static class DbConfigManager
    {

        private static Config m_Config = null;
        private static string m_strName = "com.zhongjh.Library.Database";
        private static string m_strKey = "DbConfig";

        public static DbInfoEntity GetDbInfo(string p_strKey)
        {
            if (string.IsNullOrEmpty(p_strKey))
                p_strKey = m_strKey;

            DbInfoEntity result = null;

            if (m_Config == null)
                m_Config = new Config();

            ConfigItem configItem = m_Config.GetConfigByPath(m_strName + @"/" + p_strKey);
            if (configItem != null)
            {
                result = new DbInfoEntity(configItem);
            }

            return result;
        }


    }
}
